import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore(
  'user',
  () => {
    const token = ref('')
    const setToken = (t: string) => {
      token.value = t
    }
    const removeToken = () => {
      token.value = ''
    }

    // const user = ref({})
    // const getUser = async () => {
    //   const res = await userGetInfoService() //请求获取数据
    //   user.value = res.data
    // }
    // const setUser = (obj) => {
    //   user.value = obj
    // }

    return {
      token,
      setToken,
      removeToken
      //user, getUser, setUser
    }
  },
  {
    persist: { enabled: true }
  }
)
